package entity.terrain;

import entity.Sprite;

/**
 * The objects that the Lemmings interact with. Terrain can be either 
 * destructable or non-destructable, fatal or innocuous. 
 * 
 * @author Neil Cowzer
 */
public class Terrain extends Sprite{
	/** The fatal/innocuous of this Terrian. */
	private boolean fatal;
	
	/** The destructabiltity value of this Terrain. */
	private boolean destructable;
	/*@ invariant (fatal == true && destructable = false) || 
				  (destructable == true || fatal == false) ||
				  (destructable == false || fatal == false);
	@*/
	
	/**
	 * Create a Terrain instance.
	 * 
	 * @param ref the relative (String) address of the Image.
	 * @param x the x-coordinate of the Terrain
	 * @param y the y coordinate of the Terrain
	 * @param fatal
	 * @param destructable
	 */
	/*@ requires ref != null && 0 <= x && 0 <= y;
	  	assignable fatal && destructable;
	  	ensures true;
	@*/
	public Terrain(String ref,int frames, boolean fatal, boolean destructable){
		super(ref, frames, 0, 0);
		this.fatal = fatal;
		this.destructable = destructable;
	}
	
	/**
	 * Check whether this Terrain is destructable.
	 * 
	 * @return true if Terrain is destructable.
	 */
	public /*@ pure @*/ boolean isDestructable() {
		return destructable;
	}
	
	/**
	 * Check whether a Terrain is innocuous or fatal.
	 * 
	 * @return true if a Terrain is fatal.
	 */
	public /*@ pure @*/ boolean isFatal() {
		return fatal;
	}
}
